import http from "@/utils/http";
import {selectList} from "./common";

export const selectAttentionedList = selectList('/back/attention/getAttentionPage')

export const selectFansList = selectList('/back/attention/getAttentionedPage')

// 身份申请
class identityMsgType {
    'id'?: number
    'realName': string
    'idCard': string
    'sex': number
    'address': string
    'frontalView': number
    'reverseView': number
}


export const applyAnchor = (identityMsg: identityMsgType) => {
    return http.post('/live/authentication/info', identityMsg)
}

export type {identityMsgType}

// 获取标签信息
export const selectSystemTag = () => {
    return http.get('/back/liveTag/getSystemTagByPage', {
        params: {
            pageNum: 1,
            pageSize: 100
        }
    })
}


export const getLiveRoom = (anchorId: string) => {
    return http.get('/back/liveRoom/getLiveRoom', {
        params: {
            anchorId: anchorId
        }
    })
}


//根据房间号查询直播间
export const getLiveRoomByRoomNumber = (RoomNumber: any) => {
    return http.get('/back/liveRoom/getLiveRoomByRoomNumber', {
        params: {
            roomNumber: RoomNumber
        }
    })
}

//获取标签对象
export const getLiveRoomTag = (roomId: string) => {
    return http.get('/back/roomTag/getRoomTagByRoomDTOId', {
        params: {
            roomId: roomId
        }
    })
}


// 获取观看历史
export const selectViewHistroy = selectList('/live/viewHistory/viewHistory')

// 删除浏览记录
export const deleteViewHistoryById = (id: string) => {
    return http.delete(`/live/viewHistory/${id}`)
}

// 获取直播数据
export const selectLiveHistory = selectList('/live/broadcast/liveHistory')
//修改房间标签
export const updateRoomTags = (FromData: any) => {
    return http.put("/back/roomTag/UpdateRoomTag", FromData)
}

//修改直播间信息
export const updateRoomInfo = (FromData: any) => {
    return http.post("/back/liveRoom/updateLiveRoom", FromData)
}

//修改用户信息
export const updateUserInfo = (FromDate: any) => {
    return http.put("/sys/user/update", FromDate)
}

//添加直播记录
export const beginLive = () => {
    return http.get("/live/broadcast/beginLive")
}

//结束直播
export const endLive = () => {
    return http.get("/live/broadcast/endLive")
}